* CNEP setup and analysis for: 
* Unions, Class Identification and Policy Attitudes
* Date: 03/31/22


*******************************************************************************
***** Data setup.
*******************************************************************************


* 2004 CNEP.
tempfile cnep04dat
use CN3USA2004.Fin.dta, clear

sum E_WorkTalk F_AsoTu L_Income Z_US04_L_educ2 C_PartyIDStrength_F Z_US04_L_Race L_Gender L_Age Z_US04_L_region1

recode E_WorkTalk (0 1 = 0 "Never/rarely") (2 3 = 1 "Sometimes/often"), gen(worktalk2)
xtile inc5 = L_Income, n(5)
clonevar edu = Z_US04_L_educ2
recode C_PartyIDStrength_F (0 1 = 1 "No ID/not strong") (2 = 2 "Somewhat strongly") (3 = 3 "Very strongly"), gen(pid_str)
recode Z_US04_L_Race (1 = 1 "White, Non-Hispanic") (2 3 4 = 0 "Other"), gen(white_nh)
recode L_Gender (2 = 1 "Female") (1 = 0 "Male"), gen(female)
clonevar age = L_Age
gen age2 = age^2
recode Z_US04_L_region1 (3 = 1 "South") (1 2 4 = 0 "Other"), gen(south)

gen orgpolinfo = 0 if Z_US04_F_AsoNone == 1
replace orgpolinfo = 1 if (Z_US04_F_totalinf >= 1 & Z_US04_F_totalinf != .)

gen year = 2004

keep E_WorkTalk F_AsoTu worktalk2-year

save `cnep04dat'


* 2012 CNEP.
use CN4USA2012.Fin.dta, clear

sum E_WorkTalk F_AsoTu ppincimp L_Education ppeducat C_PartyIDStrength ppethm ppgender ppage PPREG4

recode E_WorkTalk (0 1 = 0 "Never/rarely") (2 3 = 1 "Sometimes/often"), gen(worktalk2)
xtile inc5 = ppincimp, n(5)
clonevar edu = ppeducat
recode C_PartyIDStrength (995 1 = 1 "No ID/not strong") (2 = 2 "Somewhat strongly") (3 = 3 "Very strongly"), gen(pid_str)
recode ppethm (1 = 1 "White, Non-Hispanic") (2 3 4 5 = 0 "Other"), gen(white_nh)
recode ppgender (2 = 1 "Female") (1 = 0 "Male"), gen(female)
clonevar age = ppage
gen age2 = age^2
recode PPREG4 (3 = 1 "South") (1 2 4 = 0 "Other"), gen(south)
recode Q17A (1=1) (0=0) (995=.), gen(orgpolinfo)

gen year = 2012

keep E_WorkTalk F_AsoTu worktalk2-year 


* Combine datasets.
append using `cnep04dat'

notes drop _all


*******************************************************************************
***** Analysis.
*******************************************************************************


tab E_WorkTalk F_AsoTu , col 
tab orgpolinfo F_AsoTu , col 


* Discuss campaign with co-workers.
ologit E_WorkTalk i.F_AsoTu inc5 edu pid_str i.female age age2 i.white_nh i.south i.year
estimates store wrktlk_full

ologit E_WorkTalk i.F_AsoTu inc5 edu pid_str i.female age age2 i.white_nh i.south if year==2004
estimates store wrktlk_04

ologit E_WorkTalk i.F_AsoTu inc5 edu pid_str i.female age age2 i.white_nh i.south if year==2012
estimates store wrktlk_12

reg E_WorkTalk i.F_AsoTu inc5 edu pid_str i.female age age2 i.white_nh i.south i.year
estimates store wrktlk_reg

logit worktalk2 i.F_AsoTu inc5 edu pid_str i.female age age2 i.white_nh i.south i.year
estimates store wrktlk_2cat


* Received election info from organization.
logit orgpolinfo i.F_AsoTu inc5 edu pid_str i.female age age2 i.white_nh i.south i.year
estimates store orginfo_full

logit orgpolinfo i.F_AsoTu inc5 edu pid_str i.female age age2 i.white_nh i.south if year==2004
estimates store orginfo_04

logit orgpolinfo i.F_AsoTu inc5 edu pid_str i.female age age2 i.white_nh i.south if year==2012
estimates store orginfo_12




